package com.sgb.merchant.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;

import com.sgb.link.utils.AddressHelper;
import com.swgk.core.common.base.BaseViewModel;
import com.swgk.core.view.areapopup.AddressEntity;

import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * @author: 王彬臣
 * @date: 2021/9/16
 * @Description: 选择城市ViewModel
 */
public class SelectCityModel extends BaseViewModel {
    public MutableLiveData<List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>>> ldServiceCity = new MutableLiveData<>();

    public SelectCityModel(@NonNull @NotNull Application application) {
        super(application);
    }

    /**
     * 获取城市列表
     */
    public void getServiceCity() {
        AddressHelper.getInstance().getAllArea(new AddressHelper.CallBack() {
            @Override
            public void initialData(List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>> data) {
                if (data != null && data.size() > 0) {
                    ldServiceCity.postValue(data);
                }
            }

            @Override
            public void threeData(List<AddressEntity> provinceList, List<List<AddressEntity>> cityList, List<List<List<AddressEntity>>> districtList) {

            }
        });
    }
}
